package org.travel.app.controller.manage;

import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.travel.app.common.vo.ResultVO;
import org.travel.app.controller.BaseController;
import org.travel.app.entity.spots.Spots;
import org.travel.app.service.impl.SpotsServiceImpl;

/**
 * @author nmm
 * @date 2024-12-2024/12/29
 * @deriction njm......
 */
@RestController
@RequestMapping("/manageSpots")
@RequiredArgsConstructor
public class ManageSpotsController extends BaseController {
    private final SpotsServiceImpl spotsService;

    @GetMapping("/getSpotsList")
    public ResultVO getSpotsList(@RequestParam("page") int pageNum, @RequestParam("limit") int pageSize,@ModelAttribute Spots spots) {
        PageInfo<Spots> spotsList = spotsService.getSpotsList(pageNum, pageSize,spots);
        return success(spotsList);
    }

    @PostMapping("/addSpots")
    public ResultVO addSpots(@ModelAttribute Spots spots) {
    	  spotsService.saveSpots(spots);
          return success();
    }

}
